package com.qjq.glasses_shopping;

import cn.hutool.bloomfilter.BitMapBloomFilter;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@MapperScan("com.qjq.glasses_shopping.mapper")
@EnableScheduling // 开启定时任务
@EnableEncryptableProperties // 加密配置文件
public class GlassesShoppingApplication {

    public static void main(String[] args) {
        SpringApplication.run(GlassesShoppingApplication.class, args);
    }


    // 布隆过滤器配置
    @Bean
    public BitMapBloomFilter bloomFilter(){
        // 构造方法的参数 决定了布隆过滤器能存放多少元素
        BitMapBloomFilter filter = new BitMapBloomFilter(2500);
        return filter;
    }

    //分页插件
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return interceptor;
    }

}
